import React, { PureComponent } from 'react';
import styles from './input.less';
import PropTypes from 'prop-types';

export default class Input extends PureComponent {

  static propTypes = {
    img: PropTypes.string,
    value: PropTypes.string.isRequired,
    onChange: PropTypes.func.isRequired,
    type: PropTypes.string.isRequired,
    placeholder: PropTypes.string.isRequired,
    name: PropTypes.string.isRequired
  }

  render() {
    return(
        <div className={styles.inputbox}>
          <img src={this.props.img} className={styles.input_icon} />
          <input name={this.props.name} value={this.props.value} onChange={this.props.onChange} type={this.props.type} placeholder={this.props.placeholder} className={styles.input} />
        </div>
    )
  }
}